Skip to content

Conversation

@Saadnajmi
Copy link
Collaborator

Saadnajmi and others added 2 commits July 22, 2025 17:53
## Summary:

This is fixed upstream with
facebook#52472 . Let's commit (and
backport) a smaller fix for now.

## Test Plan:

Minimal repro of bug is this code below. Basically, you can't focus on
"Pressable Child 2" twice by clicking on the container

```
      <Pressable style={{backgroundColor: 'lightblue', padding: 10, gap: 10}} onPress={() => {myRef.current.focus();}}>
          <Text>Pressable Container</Text>
          <Pressable><Text>Pressable Child 1</Text></Pressable>
          <Pressable ref={myRef}><Text>Pressable Child 2</Text></Pressable>
          <Pressable><Text>Pressable Child 3</Text></Pressable>
      </Pressable>
```
## Summary:

Function keys on macOS currently get dispatched with the value from the
underlying NS*FunctionKey code point. For instance, a `F12` event gets
dispatched as `\uf70f` for
[NS12FunctionKey](https://developer.apple.com/documentation/appkit/nsf12functionkey?language=objc).
To clean this up, we should dispatch the same strings we use on other
platforms (i.e. `'F12'` for the F12 key).

## Test Plan:
I used a pressable component with a `onKeyDown` handler in
`RNTester-macOS` to test keyboard events. With this change, the function
keys come in as `F12`, `F11` etc... instead of the underlying
NS*FunctionKey code points.

---------

Co-authored-by: Colin Heffernan <[email protected]>
@Saadnajmi Saadnajmi merged commit eec1968 into microsoft:0.76-stable Jul 23, 2025
16 checks passed
@Saadnajmi Saadnajmi deleted the 0.76/backports branch July 23, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants